#ifndef Sampler_h
#define Sampler_h

#include "Filter.h"
#include "Ray.h"
#include "Color.h"

enum SampleType {SAMPLER_NONE, SAMPLER_UNIFORM, SAMPLER_JITTER};
enum FilterType {FILTER_NONE, FILTER_SBOX, FILTER_STRIANGLE, FILTER_SPHERE};

class Sampler {
	protected:
		SampleType sample_type;
		Filter* filter;
		int base_num_samples; //the square root of the number of samples per pixel. Provided by scene file
		int num_samples_x;
		int num_samples_y;
		double last_offset_x;
		double last_offset_y;
		double last_pix_coord_x;
		double last_pix_coord_y;
				
	public:
		Sampler(int num_samples, FilterType ftype);
		virtual ~Sampler();
		virtual void offsetRay(Ray& ray, int sample_num, double dx, double dy) = 0;
		virtual void applyFilter(Color* sample_colors, double* offsets_x, double* offsets_y) const = 0;
		
		inline int getNumSamples() { return num_samples_x * num_samples_y; }
		inline double getFilterSupportArea() { return filter->getSupportArea(); }
		inline double getLastOffsetX() {return last_offset_x;}
		inline double getLastOffsetY() {return last_offset_y;}
		inline double getLastPixCoordX() { return last_pix_coord_x; }
		inline double getLastPixCoordY() { return last_pix_coord_y; }
};

#endif